﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 设计模式.MVC_模式
{
    public class StudentController
    {
        public Student Model { set; get; }
        public StudentView View { set; get; }
        public StudentController(Student model, StudentView view)
        {
            this.Model = model;
            this.View = view;
        }

        public void SetStudentName(string name)
        {
            Model.Name = name;
        }

        public string GetStudentName()
        {
            return Model.Name;
        }

        public void SetStudentRollNo(string rollNo)
        {
            Model.RollNo = rollNo;
        }

        public string GetStudentRollNo()
        {
            return Model.RollNo;
        }

        public void UpdateView()
        {
            View.PrintStudentDetails(Model.Name, Model.RollNo);
        }
    }
}
